{include file="public/toper" /}
<div class="x-nav">
    <span class="layui-breadcrumb">
        <a href="">会员管理</a>
        <a href="">会员列表</a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.reload(true);" title="刷新"><i class="layui-icon" style="line-height:30px">&#xe666;</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
            <input type="text" name="sreach" value=""  style="width:250px;" id="key"   placeholder="名称/手机号" autocomplete="off" class="layui-input">
            <button class="layui-btn" id="search"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </div>
    <table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="name">
    <div><a href="#" id="userOrder" data-title="订单列表" data-href="{:url(\'Order/index\')}?uid={{d.user_id}}"  data="18" title="查看销售订单" class="layui-table-link">{{d.name}}</a></div>
</script>
<script type="text/html" id="phone">
    <div><a href="#" id="userOrder" data-title="会员卡订单列表" data-href="{:url(\'Corder/index\')}?uid={{d.user_id}}"  data="25" title="查看会员卡订单" class="layui-table-link">{{d.phone}}</a></div>
</script>
<script type="text/html" id="image">
    <img src="{{d.img}}" class="thumb" thumb="{{ d.img }}"/>
</script>
<script type="text/html" id="sj">
    <div>{{#  if(d.whether_member==1){ }}{{layui.util.toDateString(d.validity_time*1000,"yyyy-MM-dd") }}{{#  } else { }}无{{#  } }} </div>
</script>

<script type="text/html" id="lower">
    <div><a href="#" onclick="x_admin_show('查看','{:url(\'User/lower\')}?id={{d.user_id}}','500','400')" title="查看下级结构" class="layui-table-link">{{#  if(d.lower==null){ }}无{{#  } else { }}{{d.lower}}{{#  } }}</a></div>
</script>
<script>
    layui.use(['table','util'], function(){
        var table = layui.table, $ = layui.jquery;
        var layer = layui.layer;
        var loading = layer.load(1, {shade: [0.1,'#fff'] });
        var tableIn = table.render({
            method: 'post',
            elem: '#test'
            ,url: "{:url('User/index')}"
            ,id:'test'
            ,cols: [[
                {field:'user_id', width:80, title: '序号',align: 'center',type:'numbers'}
                ,{width: 150,title: '名称', align: 'center',toolbar: '#name'}
                ,{title: '头像',width:100,templet: '#image',align: 'center'}
                ,{toolbar:'#phone', width:140, title: '手机号',align: 'center'}
                ,{field:'lower', width:130, title: '上级',align: 'center',templet:'#lower'}
                ,{field:'one', width:80, title: '一级数',align: 'center'}
                ,{field:'two', width:80, title: '二级数',align: 'center'}
                ,{field:'whether_member', width:120, title: '是否会员',align: 'center',style:'color:#c91a54',templet: function(d){if(d.whether_member==0){ return '不是';}else if (d.whether_member==1){ return '是';}else if (d.whether_member==2){ return '过期';}}}
                ,{field:'validity_time', width:130, title: '会员卡有效期',align: 'center',templet: '#sj'}
                ,{field:'card_type', width:100, title: '会员卡类型',align: 'center'}
                ,{field:'money', width:130, title: '会员卡金额',align: 'center'}
                ,{field:'distribut_money', width:100, title: '已结算佣金',align: 'center'}
                ,{field:'unsettled_money', width:100, title: '未结算佣金',align: 'center'}
                ,{field: 'time',width: 180, sort:'true',title: '注册时间', templet: '<div>{{layui.util.toDateString(d.time*1000) }}</div>',align: 'center'}
                // ,{width: 140,title: '操作', align: 'center', toolbar: '#action'}
            ]]
            ,page: true
            ,limit: 30
            ,limits:[30,60,90,120,150,180,210,240,270,300]
        });
        layer.close(loading);

        $('#search').on('click', function () {
            tableIn.reload({
                where: {key: $('#key').val()}
                ,page: {curr: 1 }
            });
        });
    });
</script>
{include file="public/footer"/}